package a.f.h.d;

import a.c.e;
import a.c.w;
import a.c.x;
import a.f.h.b.b;
import a.f.h.b.f;
import a.f.j.o;
import a.f.j.p;
import a.i.mb;

import java.util.ArrayList;

public class j
  implements b
{
  protected a.c.q a;
  protected f b;
  protected a.c.n c;
  protected a.c.n d;
  protected a.c.n e;
  protected a.c.n f;
  protected a.c.n g;
  protected a.c.n h;
  protected a.c.n i;
  protected int j = 0;
  protected static final Integer k = new Integer(0);
  protected static final Integer l = new Integer(1);
  protected static final Integer m = new Integer(3);
  protected boolean n = false;
  protected q o = new m();
  private boolean p = false;
  public static boolean q;
  public static int r;
  
  public void a(f paramf)
  {
    this.b = paramf;
    this.a = paramf.a();
  }
  
  public boolean c()
  {
    return this.n;
  }
  
  public void a(boolean paramBoolean)
  {
    this.n = paramBoolean;
  }
  
  public boolean d()
  {
    return this.p;
  }
  
  public void b(boolean paramBoolean)
  {
    this.p = paramBoolean;
  }
  
  public void a(q paramq)
  {
    this.o = paramq;
  }
  
  public int b()
  {
    return this.j;
  }
  
  public void a()
  {
    a.c.n localn = this.a.C();
    a(localn);
    this.b.a(localn, this.a.w().a(), k.a);
    this.a.a(localn);
  }
  
  public void a(a.c.n paramn)
  {
    a.c.q localq = new a.c.q();
    a.c.n localn = localq.C();
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    x localx = localq.B();
    e[] arrayOfe = new e[2];
    int i1 = a(localq, localn, localArrayList1, arrayOfe, localx, localArrayList2);
    a(localq, i1, localn, arrayOfe, localArrayList1, localArrayList2, paramn, localx);
    if (r == 0)
    {
      if (this.p) {
        a(this.b, paramn);
      }
      localq.a(localn);
      localq.a(localx);
    }
  }
  
  protected int a(a.c.q paramq, a.c.n paramn, ArrayList paramArrayList1, e[] paramArrayOfe, x paramx, ArrayList paramArrayList2)
  {
    int i4 = r;
    boolean bool = q;
    this.f = this.a.C();
    this.g = this.a.C();
    this.c = this.a.C();
    this.d = this.a.C();
    this.e = this.a.C();
    x localx = this.a.B();
    p localp = this.b.h();
    this.i = paramq.C();
    this.h = paramq.C();
    e locale1 = paramq.i();
    paramx.a(locale1, "S");
    e locale2 = paramq.i();
    paramx.a(locale2, "T");
    paramArrayOfe[0] = locale1;
    paramArrayOfe[1] = locale2;
    int i1 = 0;
    w localw = this.a.v();
    Object localObject3;
    do
    {
      if (!localw.e()) {
        break;
      }
      localObject1 = localw.d();
      localObject2 = paramq.i();
      paramx.a(localObject2, "V(" + localObject1 + ")");
      localx.a(localObject1, localObject2);
      if ((i4 == 0) && (bool)) {
        break label374;
      }
      if (i4 == 0)
      {
        if (((e)localObject1).d() < 4)
        {
          localObject3 = paramq.a(locale1, (e)localObject2);
          paramn.a(localObject3, k);
          paramArrayList1.add(new d((a.c.d)localObject3, 4 - ((e)localObject1).d()));
          i1 += 4 - ((e)localObject1).d();
        }
        if (i4 != 0) {}
      }
      else
      {
        if (((e)localObject1).d() > 4)
        {
          localObject3 = paramq.a((e)localObject2, locale2);
          paramn.a(localObject3, k);
          paramArrayList1.add(new d((a.c.d)localObject3, ((e)localObject1).d() - 4));
        }
        localw.f();
      }
    } while (!bool);
    label374:
    int i2 = 0;
    Object localObject1 = this.b.c();
    Object localObject4;
    label559:
    do
    {
      do
      {
        if (!((o)localObject1).e()) {
          break;
        }
        localObject2 = ((o)localObject1).a();
        localObject3 = paramq.i();
        paramx.a(localObject3, "F(" + i2++ + ")");
        if ((i4 == 0) && (bool)) {
          break label743;
        }
        if (i4 == 0)
        {
          if (((a.f.j.n)localObject2).a().k() < 4)
          {
            if (i4 != 0) {
              break label559;
            }
            if (this.b.d() != localObject2)
            {
              localObject4 = paramq.a(locale1, (e)localObject3);
              paramn.a(localObject4, k);
              paramArrayList1.add(new d((a.c.d)localObject4, 4 - ((a.f.j.n)localObject2).a().k()));
              i1 += 4 - ((a.f.j.n)localObject2).a().k();
            }
          }
          if (i4 != 0) {}
        }
        else if (((a.f.j.n)localObject2).a().k() > 4)
        {
          if (i4 != 0) {
            break label649;
          }
          if (this.b.d() != localObject2)
          {
            localObject4 = paramq.a((e)localObject3, locale2);
            paramn.a(localObject4, k);
            paramArrayList1.add(new d((a.c.d)localObject4, ((a.f.j.n)localObject2).a().k() - 4));
          }
        }
        if (this.b.d() == localObject2)
        {
          localObject4 = paramq.a((e)localObject3, locale2);
          paramn.a(localObject4, k);
          paramArrayList1.add(new d((a.c.d)localObject4, ((a.f.j.n)localObject2).a().k() + 4));
        }
        localp.a((a.f.j.n)localObject2, localObject3);
        ((o)localObject1).f();
      } while (!bool);
    } while (i4 != 0);
    label649:
    localObject1 = this.b.c();
    label743:
    Object localObject5;
    Object localObject6;
    Object localObject7;
    label910:
    Object localObject8;
    Object localObject9;
    label1018:
    do
    {
      if (!((o)localObject1).e()) {
        break;
      }
      localObject2 = ((o)localObject1).a();
      localObject3 = (e)localp.get(localObject2);
      localObject4 = ((a.f.j.n)localObject2).a();
      do
      {
        do
        {
          if (!((a.c.m)localObject4).e()) {
            break label1018;
          }
          localObject5 = ((a.c.m)localObject4).a();
          localObject6 = (e)localx.get(((a.c.d)localObject5).e());
          if (bool) {
            break;
          }
          if (((a.c.d)localObject5).e().e() <= 4)
          {
            localObject7 = paramq.a((e)localObject6, (e)localObject3);
            paramn.a(localObject7, k);
            if (i4 == 0) {
              if (this.b.b(((a.c.d)localObject5).e()))
              {
                paramArrayList1.add(new d((a.c.d)localObject7, 0));
                if ((i4 == 0) && (!bool)) {
                  break label910;
                }
              }
            }
            paramArrayList1.add(new d((a.c.d)localObject7, 3));
            this.f.a(localObject5, localObject7);
          }
          localObject7 = this.b.b(this.b.a((a.c.d)localObject5));
          localObject8 = (e)localp.get(localObject7);
          localObject9 = paramq.a((e)localObject3, (e)localObject8);
          paramn.a(localObject9, l);
          this.c.a(localObject5, localObject9);
          paramArrayList1.add(new d((a.c.d)localObject9, 10000));
          ((a.c.m)localObject4).f();
        } while (!bool);
        ((o)localObject1).f();
      } while (i4 != 0);
    } while (!bool);
    localObject1 = this.a.C();
    Object localObject2 = this.a.v();
    label1327:
    label1329:
    label1784:
    do
    {
      if (!((w)localObject2).e()) {
        break;
      }
      localObject3 = ((w)localObject2).d();
      if (bool) {
        break label1881;
      }
      if ((!this.b.b((e)localObject3)) && (((i4 == 0) && (!this.n)) || (((e)localObject3).d() > 4)))
      {
        Object localObject11;
        do
        {
          localObject4 = (e)localx.get(localObject3);
          localObject5 = ((e)localObject3).n();
          do
          {
            do
            {
              if (!((a.c.m)localObject5).e()) {
                break;
              }
              localObject6 = paramq.i();
              paramx.a(localObject6, "H(" + localObject3 + "," + paramx.get(localp.get(this.b.b(((a.c.m)localObject5).a()))) + ")");
              ((a.c.n)localObject1).a(((a.c.m)localObject5).a(), localObject6);
              localObject7 = paramq.a((e)localObject6, (e)localObject4);
              paramn.a(localObject7, k);
              paramArrayList1.add(new d((a.c.d)localObject7, 1));
              this.g.a(((a.c.m)localObject5).a(), localObject7);
              if (i4 != 0) {
                break label1329;
              }
              ((a.c.m)localObject5).f();
              if (bool) {
                break label1327;
              }
            } while (!bool);
          } while (i4 != 0);
          ((a.c.m)localObject5).h();
          localObject6 = ((a.c.m)localObject5).a();
          localObject7 = null;
          localObject8 = null;
          localObject9 = null;
          Object localObject10 = null;
          localObject11 = null;
          ArrayList localArrayList = new ArrayList();
          int i3 = 0;
          do
          {
            if (i3 >= ((e)localObject3).e()) {
              break label1784;
            }
            ((a.c.m)localObject5).b();
            localObject7 = localObject6;
            localObject6 = ((a.c.m)localObject5).a();
            a.f.j.n localn1 = this.b.b((a.c.d)localObject6);
            a.f.j.n localn2 = this.b.b((a.c.d)localObject7);
            e locale3 = paramq.i();
            e locale4 = paramq.i();
            paramx.a(locale3, "NC-L (" + ((a.c.d)localObject7).f() + "," + localObject3 + ")");
            paramx.a(locale4, "NC-R (" + ((a.c.d)localObject7).f() + "," + localObject3 + ")");
            a.c.d locald1 = paramq.a((e)localp.get(localn1), (e)((a.c.n)localObject1).get(localObject7));
            paramn.a(locald1, l);
            this.e.a(localObject7, locald1);
            a.c.d locald2 = paramq.a((e)localp.get(localn2), (e)((a.c.n)localObject1).get(localObject6));
            paramn.a(locald2, l);
            this.d.a(localObject7, locald2);
            if (bool) {
              break;
            }
            if (localObject8 != null)
            {
              this.h.a(locald1, localObject8);
              this.i.a(localObject8, locald1);
            }
            if (i4 == 0)
            {
              if (localObject9 != null)
              {
                this.i.a(locald2, localObject9);
                this.h.a(localObject9, locald2);
              }
              localObject9 = locald2;
              localObject8 = locald1;
            }
            if (i4 == 0) {
              if (localObject11 == null) {
                localObject11 = localObject9;
              }
            }
            if ((i4 != 0) || (localObject10 == null)) {
              localObject10 = localObject8;
            }
            d locald = new d(1);
            locald.a(locald2);
            locald.a(locald1);
            paramArrayList1.add(locald);
            localArrayList.add(locald);
            i3++;
          } while (!bool);
          paramArrayList2.add(localArrayList);
          this.h.a(localObject10, localObject8);
          this.i.a(localObject8, localObject10);
          this.i.a(localObject11, localObject9);
        } while (i4 != 0);
        this.h.a(localObject9, localObject11);
      }
      ((w)localObject2).f();
    } while (!bool);
    this.a.a((a.c.n)localObject1);
    this.a.a(localx);
    label1881:
    return i1;
  }
  
  protected double a(a.c.q paramq, int paramInt, a.c.n paramn1, e[] paramArrayOfe, ArrayList paramArrayList1, ArrayList paramArrayList2, a.c.n paramn2, x paramx)
  {
    int i9 = r;
    boolean bool = q;
    mb localmb = new mb();
    a.c.n localn = paramq.C();
    double d1 = -1.0D;
    d1 = this.o.a(paramq, paramArrayOfe[0], paramArrayOfe[1], paramn1, localn, paramInt, paramArrayList1, paramArrayList2, this.h, this.i);
    a.i.n.a(this, "---> Solving Network took " + localmb);
    localmb.g();
    StringBuffer localStringBuffer = new StringBuffer(12);
    a.c.m localm = this.a.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      a.c.d locald1 = localm.a();
      a.c.d locald2 = this.b.a(localm.a());
      localStringBuffer.setLength(0);
      Object localObject1 = this.e.get(locald1);
      if (bool) {
        break label634;
      }
      int i1 = localObject1 != null ? localn.getInt(localObject1) : 0;
      Object localObject2 = this.d.get(locald1);
      int i2 = localObject2 != null ? localn.getInt(localObject2) : 0;
      a(localStringBuffer, i2, '<');
      a(localStringBuffer, i1, '>');
      int i3 = localn.getInt(this.c.get(locald1));
      int i4 = localn.getInt(this.c.get(locald2));
      a(localStringBuffer, i4, '>');
      a(localStringBuffer, i3, '<');
      Object localObject3 = this.e.get(locald2);
      int i5 = localObject3 != null ? localn.getInt(localObject3) : 0;
      Object localObject4 = this.d.get(locald2);
      int i6 = localObject4 != null ? localn.getInt(localObject4) : 0;
      a(localStringBuffer, i5, '<');
      a(localStringBuffer, i6, '>');
      this.j += localStringBuffer.length();
      paramn2.a(locald1, localStringBuffer.toString());
      Object localObject5 = this.f.get(locald1);
      int i7 = localObject5 != null ? localn.getInt(localObject5) : 0;
      Object localObject6 = this.g.get(locald1);
      int i8 = localObject6 != null ? localn.getInt(localObject6) : 0;
      this.b.a(locald1, i7 - i8 + 1);
      localm.f();
    } while (!bool);
    a.i.n.a(this, 1, "Number of bends: " + this.j / 2);
    this.j /= 2;
    a.i.n.a(this, 3, "---> Parsing Network solution took " + localmb);
    this.a.a(this.f);
    this.a.a(this.g);
    this.a.a(this.c);
    this.a.a(this.d);
    if (i9 == 0) {
      this.a.a(this.e);
    }
    label634:
    return d1;
  }
  
  protected void a(f paramf, a.c.n paramn)
  {
    int i12 = r;
    boolean bool = q;
    Object localObject1 = paramf.c();
    Object localObject2;
    Object localObject3;
    Object localObject4;
    label207:
    label232:
    label492:
    do
    {
      if (!((o)localObject1).e()) {
        break;
      }
      localObject2 = null;
      localObject3 = ((o)localObject1).a();
      localObject4 = ((a.f.j.n)localObject3).a();
      int i1 = 0;
      int i2 = 0;
      int i3 = 0;
      int i4 = 0;
      do
      {
        do
        {
          if (!((a.c.m)localObject4).e()) {
            break;
          }
          localObject5 = ((a.c.m)localObject4).a();
          if (bool) {
            break label207;
          }
          if (((a.c.d)localObject5).e().c() == 4)
          {
            i1++;
            if (i12 != 0) {
              continue;
            }
            if (!bool) {}
          }
          else if (i12 == 0)
          {
            if (((a.c.d)localObject5).e().c() == 6)
            {
              i2++;
              if (i12 != 0) {
                continue;
              }
              if (localObject2 == null)
              {
                localObject2 = localObject5;
                i4 = 6;
                if (i12 != 0) {
                  continue;
                }
                if (!bool) {}
              }
            }
            else
            {
              if (i12 != 0) {
                continue;
              }
            }
          }
          else if (((a.c.d)localObject5).e().c() > i4)
          {
            localObject2 = localObject5;
            i4 = ((a.c.d)localObject5).e().c();
          }
          i3++;
          ((a.c.m)localObject4).f();
        } while (!bool);
      } while (i12 != 0);
      if (i3 > 4)
      {
        if (i12 != 0) {
          break label232;
        }
        if (i1 > 0) {}
      }
      else
      {
        if (i12 != 0) {
          continue;
        }
        if (i2 <= 0) {
          break label694;
        }
      }
      Object localObject5 = new a.c.d[i3];
      int i5 = 0;
      int i6 = 0;
      Object localObject6 = null;
      a.c.m localm = ((a.f.j.n)localObject3).a();
      if ((i12 != 0) || (localObject2 != null)) {}
      while (i12 != 0) {
        do
        {
          if (localm.a() == localObject2) {
            break;
          }
          if (i12 != 0) {
            break label311;
          }
          localm.b();
          if (bool) {
            break label309;
          }
        } while (!bool);
      }
      localm.c();
      Object localObject7 = localm.a();
      localObject6 = paramf.b(paramf.a((a.c.d)localObject7));
      localm.b();
      int i7 = 0;
      do
      {
        if (i7 >= i3) {
          break;
        }
        a.c.d locald = localm.a();
        int i8 = locald.e().c();
        a.f.j.n localn = paramf.b(paramf.a(locald));
        Object localObject8 = paramn.get(locald);
        if (bool) {
          break label676;
        }
        if ((localObject8 instanceof String)) {
          if (i12 != 0) {}
        }
        int i9 = ((String)localObject8).length() > 0 ? 1 : 0;
        int i10 = paramf.e(locald) - 2;
        if (i12 == 0) {
          if (i10 >= -1) {
            if (i12 != 0) {
              break label457;
            }
          }
        }
        int i11 = i10 > 1 ? 1 : 0;
        if (localn == localObject6)
        {
          if (i12 != 0) {
            break label492;
          }
          if (i9 == 0)
          {
            if (i12 != 0) {
              break label527;
            }
            if (i11 == 0) {
              break label525;
            }
          }
        }
        if (i12 == 0)
        {
          if (i5 > 0) {
            a(paramn, (a.c.d[])localObject5, i5, i6, (a.f.j.n)localObject3, (a.f.j.n)localObject6);
          }
          i5 = 0;
        }
        i6 = 0;
        localObject6 = localn;
        if (i12 == 0) {
          if (i11 == 0)
          {
            if (i12 == 0) {
              if (i5 != 0)
              {
                if (i12 != 0) {
                  break label570;
                }
                if (i8 != 4)
                {
                  if (i12 != 0) {
                    break label617;
                  }
                  if (i8 != 6) {
                    break label615;
                  }
                }
              }
            }
            if (i12 != 0) {
              break label617;
            }
            if (i9 == 0)
            {
              if (i12 == 0)
              {
                if (i5 > 0) {
                  i6 += i10;
                }
                localObject5[(i5++)] = locald;
              }
              if (i12 != 0) {
                continue;
              }
              if (!bool) {
                break label650;
              }
            }
          }
        }
        if (i12 == 0)
        {
          if (i5 > 0) {
            a(paramn, (a.c.d[])localObject5, i5, i6, (a.f.j.n)localObject3, (a.f.j.n)localObject6);
          }
          i5 = 0;
        }
        i6 = 0;
        localObject6 = localn;
        localObject7 = locald;
        localm.b();
        i7++;
      } while (!bool);
      if (i12 == 0)
      {
        if (i5 > 0) {
          a(paramn, (a.c.d[])localObject5, i5, i6, (a.f.j.n)localObject3, (a.f.j.n)localObject6);
        }
        ((o)localObject1).f();
      }
    } while (!bool);
    label309:
    label311:
    label457:
    label615:
    label617:
    localObject1 = this.a.v();
    label525:
    label527:
    label570:
    do
    {
      if (!((w)localObject1).e()) {
        break;
      }
      localObject2 = ((w)localObject1).d();
      if (i12 == 0)
      {
        if (((e)localObject2).c() == 4)
        {
          localObject3 = ((e)localObject2).h();
          localObject4 = ((e)localObject2).j();
          if (i12 != 0) {
            continue;
          }
          if (paramf.b((a.c.d)localObject3) == paramf.b((a.c.d)localObject4))
          {
            paramf.a((a.c.d)localObject3, 2);
            paramf.a((a.c.d)localObject4, 2);
          }
        }
        ((w)localObject1).f();
      }
    } while (!bool);
    label650:
    label676:
    label694:
    return;
  }
  
  private final void a(a.c.n paramn, e parame, a.c.d[] paramArrayOfd, int paramInt)
  {
    int i7 = r;
    boolean bool = q;
    if (i7 == 0) {
      if (paramInt < 4) {
        return;
      }
    }
    int i1 = 0;
    int i2 = 0;
    do
    {
      do
      {
        if (i2 >= paramInt) {
          break;
        }
        a.c.d locald1 = paramArrayOfd[i2];
        i4 = this.b.e(locald1);
        i1 += i4;
        Object localObject = paramn.get(locald1);
        if (i7 != 0) {
          break label188;
        }
        if (bool) {
          break label186;
        }
        if ((i7 != 0) || (localObject != null)) {
          if (((i7 != 0) || ((localObject instanceof String))) && ((i7 != 0) || (((String)localObject).length() <= 1)))
          {
            if (i7 != 0) {
              continue;
            }
            if (!"".equals(localObject))
            {
              if (i7 != 0) {
                continue;
              }
              if (!">".equals(localObject))
              {
                if (i7 != 0) {
                  continue;
                }
                if ("<".equals(localObject)) {}
              }
            }
          }
          else
          {
            return;
          }
        }
        i2++;
      } while (!bool);
    } while (i7 != 0);
    i2 = paramInt / i1;
    label186:
    label188:
    int i3 = i2;
    int i4 = i3 / 2;
    int i5 = 0;
    a.c.d locald3;
    label273:
    do
    {
      if (i5 >= paramInt) {
        break;
      }
      locald3 = paramArrayOfd[i5];
      a.c.d locald4 = this.b.a(locald3);
      if (bool) {
        break label388;
      }
      if (i3 != 0)
      {
        if (i7 == 0) {
          if (i5 != 0) {
            break label273;
          }
        }
      }
      else
      {
        paramn.a(locald3, "");
        paramn.a(locald4, "");
      }
      if (i7 == 0) {
        if (bool)
        {
          paramn.a(locald3, ">");
          paramn.a(locald4, "<");
        }
      }
      if ((i7 != 0) || (i3 == 0))
      {
        if (i7 == 0)
        {
          if (i1 > 0)
          {
            this.b.a(locald3, 1);
            paramn.a(locald3, "");
            paramn.a(locald4, "");
            i1--;
          }
          i3 = i2;
        }
        if (i7 != 0) {
          continue;
        }
        if (!bool) {}
      }
      else
      {
        this.b.a(locald3, 0);
        i3--;
      }
      i5++;
    } while (!bool);
    if (i7 == 0)
    {
      if (i1 > 0)
      {
        label388:
        a.c.d locald2 = paramArrayOfd[(paramInt - 1)].i();
        if ((i7 != 0) || (locald2 == null)) {
          locald2 = parame.h();
        }
        do
        {
          if (i1 <= 0) {
            break;
          }
          this.b.a(locald2, this.b.e(locald2) + 1);
          i1--;
          if (i7 != 0) {
            break label475;
          }
          if (bool) {
            break label474;
          }
        } while (!bool);
      }
      if (i7 != 0) {}
    }
    else
    {
      System.out.println("done");
    }
    label474:
    label475:
    int i6 = 0;
    do
    {
      if (i6 >= paramInt) {
        break;
      }
      locald3 = paramArrayOfd[i6];
      System.out.println("\nangle " + this.b.e(locald3));
      System.out.println("bends " + paramn.get(locald3));
      i6++;
    } while (!bool);
  }
  
  private final void a(a.c.n paramn, a.c.d[] paramArrayOfd, int paramInt1, int paramInt2, a.f.j.n paramn1, a.f.j.n paramn2)
  {
    int i6 = r;
    boolean bool = q;
    if (paramInt1 <= 1) {
      return;
    }
    a.c.d locald1 = paramArrayOfd[0];
    if (i6 == 0) {}
    Object localObject = locald1.k() == null ? locald1.e().j() : locald1.k();
    if (i6 == 0) {
      if ((this.b.b((a.c.d)localObject) != paramn2) && ((i6 != 0) || (locald1.e().c() == 6)))
      {
        if (i6 == 0) {}
        localObject = ((a.c.d)localObject).k() == null ? ((a.c.d)localObject).e().j() : ((a.c.d)localObject).k();
      }
    }
    if (this.b.b((a.c.d)localObject) == paramn2) {
      label136:
      do
      {
        if (paramInt2 >= 0) {
          break;
        }
        break;
        if (bool) {
          break label243;
        }
        if (this.b.e(locald1) <= 1) {
          break;
        }
        if (i6 != 0) {
          break label230;
        }
        if (this.b.e((a.c.d)localObject) >= 3) {
          break;
        }
        paramInt2++;
        this.b.a(locald1, this.b.e(locald1) - 1);
        this.b.a((a.c.d)localObject, this.b.e((a.c.d)localObject) + 1);
      } while (!bool);
    }
    label230:
    label243:
    do
    {
      break label307;
      if (i6 != 0) {
        break label136;
      }
      if ((paramInt2 > 0) && (this.b.e((a.c.d)localObject) > 1)) {
        if (i6 == 0)
        {
          if (this.b.e(locald1) < 3)
          {
            paramInt2--;
            this.b.a(locald1, this.b.e(locald1) + 1);
            this.b.a((a.c.d)localObject, this.b.e((a.c.d)localObject) - 1);
          }
        }
        else {
          if (!bool) {
            break;
          }
        }
      }
      locald1 = paramArrayOfd[(paramInt1 - 1)];
    } while (i6 != 0);
    label307:
    localObject = locald1.f();
    a.c.d locald2 = this.b.a(locald1);
    a.c.d locald3 = ((e)localObject).h();
    if (this.b.b(locald3) != paramn1) {}
    while (i6 != 0)
    {
      locald3 = locald3.i();
      if ((i6 == 0) && (bool)) {
        break label594;
      }
      if (!bool) {
        break;
      }
    }
    if ((locald3 != locald1) && (this.b.b(locald2) == paramn2)) {
      do
      {
        if (paramInt2 >= 0) {
          break;
        }
        break;
        if (bool) {
          break label525;
        }
        if (this.b.e(locald3) <= 1) {
          break;
        }
        if (i6 != 0) {
          break label507;
        }
        if (this.b.e(locald2) >= 3) {
          break;
        }
        paramInt2++;
        this.b.a(locald3, this.b.e(locald3) - 1);
        this.b.a(locald2, this.b.e(locald2) + 1);
      } while (!bool);
    }
    label507:
    while (i6 != 0) {
      do
      {
        for (;;)
        {
          break;
          if (i6 == 0)
          {
            if (paramInt2 <= 0) {
              break label594;
            }
            if (bool) {
              break label600;
            }
            if (this.b.e(locald2) <= 1) {
              break label594;
            }
            if (i6 != 0) {
              break label591;
            }
            if (this.b.e(locald3) >= 3) {
              break label594;
            }
            paramInt2--;
            this.b.a(locald3, this.b.e(locald3) + 1);
            this.b.a(locald2, this.b.e(locald2) - 1);
          }
        }
      } while (!bool);
    }
    label525:
    label591:
    label594:
    label600:
    int i1 = 1;
    label783:
    label788:
    label884:
    label1021:
    do
    {
      do
      {
        if (i1 >= paramInt1) {
          break;
        }
        localObject = paramArrayOfd[i1].e();
        if (i6 == 0)
        {
          locald2 = paramArrayOfd[i1];
          if (bool) {
            return;
          }
        }
        if (i6 == 0) {}
        locald3 = locald2.k() == null ? ((e)localObject).j() : locald2.k();
        if (i6 == 0) {
          if (this.b.b(locald3) != paramn2) {
            throw new IllegalStateException("Wrong face!");
          }
        }
        int i2 = this.b.e(locald2);
        if (i6 == 0) {
          if (paramInt2 < 0)
          {
            paramInt2++;
            i3 = 1;
            if (i6 != 0) {
              break label788;
            }
            if (!bool) {
              break label783;
            }
          }
        }
        if (i6 == 0) {
          if (paramInt2 > 0)
          {
            if (i6 == 0) {
              if (((e)localObject).c() == 4)
              {
                paramInt2--;
                i3 = 3;
                if (i6 != 0) {
                  break label788;
                }
                if (!bool) {
                  break label783;
                }
              }
            }
            i3 = 2;
            if (i6 != 0) {
              break label788;
            }
            if (!bool) {
              break label783;
            }
          }
        }
        int i3 = 2;
        int i4 = i3 - i2;
        if (i6 == 0)
        {
          if (i4 != 0)
          {
            int i5 = this.b.e(locald3);
            if (i6 == 0) {
              if (i5 - i4 >= 1)
              {
                if (i6 != 0) {
                  break label884;
                }
                if (i5 - i4 < 4)
                {
                  this.b.a(locald3, i5 - i4);
                  this.b.a(locald2, i2 + i4);
                  if (i6 != 0) {
                    continue;
                  }
                  if (!bool) {
                    break label1041;
                  }
                }
              }
            }
            if (((e)localObject).c() == 6)
            {
              if (i6 == 0) {}
              locald3 = locald3.k() == null ? ((e)localObject).j() : locald3.k();
              if (i6 == 0) {
                if (this.b.b(locald3) != paramn2) {
                  throw new IllegalStateException("Wrong face!");
                }
              }
              i5 = this.b.e(locald3);
              if (i6 == 0)
              {
                if (i5 - i4 < 1) {
                  break label1021;
                }
                if (i6 != 0) {}
              }
              else
              {
                if (i5 - i4 >= 4) {
                  break label1021;
                }
                this.b.a(locald3, i5 - i4);
                this.b.a(locald2, i2 + i4);
              }
              if (i6 != 0) {
                continue;
              }
              if (bool) {
                throw new IllegalStateException("Could not assign new angle!");
              }
            }
            else
            {
              throw new IllegalStateException("Incompatible degree!");
            }
          }
          i1++;
        }
      } while (!bool);
    } while (i6 != 0);
    label1041:
    if (paramInt2 != 0) {
      throw new IllegalStateException("Could not compensate directions changes.");
    }
  }
  
  protected static void a(StringBuffer paramStringBuffer, int paramInt, char paramChar)
  {
    int i2 = r;
    boolean bool = q;
    do
    {
      for (int i1 = 0; !bool; i1++)
      {
        if (i1 >= paramInt) {
          break;
        }
        paramStringBuffer.append(paramChar);
      }
    } while (i2 != 0);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.d.j

 * JD-Core Version:    0.7.0.1

 */